#define _CRT_SECURE_NO_WARNINGS 1
#include<string>
using namespace std;

class Solution {
public:
    int maxScore(string s)
    {
        int ret = 0;
        int count = 0;
        if (s[0] == '0')
            count++;
        for (int i = 1; i < s.size(); i++)
        {
            if (s[i] == '1')
                count++;
        }
        ret = count;
        for (int i = 1; i < s.size() - 1; i++)
        {
            if (s[i] == '0')
                count++;
            else
                count--;
            ret = max(ret, count);
        }
        return ret;
    }
};